namespace _5._14._2015App.Data.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    using _5._14._2015.App.Data.Model;

    internal sealed class Configuration : DbMigrationsConfiguration<_5._14._2015App.Data.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(_5._14._2015App.Data.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
            context.Estudiantes.AddOrUpdate(
                s => s.Id,
                new Student {Id = 1, StudentAge = 23, StudentFirstName = "Carlos", StudentLastName = "Montana", StudentMajor = "Biologia"},
                new Student {Id = 2, StudentAge = 25, StudentFirstName = "Tony", StudentLastName = "Escobar", StudentMajor = "Fisica"},
                new Student {Id = 3, StudentAge = 27, StudentFirstName = "Esteban", StudentLastName = "Rebanga", StudentMajor = "quimica"},
                new Student {Id = 4, StudentAge = 26, StudentFirstName = "Sebastian", StudentLastName = "Gonzales", StudentMajor = "Matematicas"},
                new Student {Id = 5, StudentAge = 29, StudentFirstName = "Sebastian", StudentLastName = "Hernandez", StudentMajor = "Biologia"},
                new Student {Id = 6, StudentAge = 30, StudentFirstName = "Sebastian", StudentLastName = "Mendoza", StudentMajor = "Matematicas"}
            );
            context.Cursos.AddOrUpdate(
               c => c.CourseID,
               new Course {CourseID = 1, CourseName = "Matematicas y Agricultura", CourseMajor = CourseMajor.Engineering, CourseHours = 55},
                new Course {CourseID = 2, CourseName = "Agricultura", CourseMajor = CourseMajor.SocialSciences, CourseHours = 30},
                 new Course {CourseID = 3, CourseName = "Matematicas", CourseMajor = CourseMajor.ComputerScience , CourseHours = 42}
                );
            context.EstudiantesConCursos.AddOrUpdate(
                e => e.StudentsANDCoursesId,
                new StudentsANDCourses {StudentsANDCoursesId = 1, StudentId = 1, CourseId = 2},
                 new StudentsANDCourses {StudentsANDCoursesId = 2, StudentId = 2, CourseId = 1},
                  new StudentsANDCourses {StudentsANDCoursesId = 3, StudentId = 2, CourseId = 2},
                   new StudentsANDCourses {StudentsANDCoursesId = 4, StudentId = 1, CourseId = 3}
                
                );
        }

    }
}
